BusyBox 学习 教程

您所在的位置:网站首页 linux makefile教程 BusyBox 学习 教程

BusyBox 学习 教程

#BusyBox 学习 教程 | 来源: 网络整理| 查看: 265

BusyBox 学习 教程 #

主要是学习,难免有很多错误,欢迎指正

BusyBox 是什么 #

BusyBox 将许多常见的 UNIX 实用程序的青春版合并到一个小的可执行文件中。通常在 GNU coreutils、util-linux 等软件中找到的大多数实用程序,BusyBox 都为你提供了极简的替代方案。BusyBox 中的实用程序往往比其全功能的 GNU 表亲拥有更少的选项;然而,所包含的选项提供了预期的功能,其行为与 GNU 的同类程序非常相似。

BusyBox 编译安装 #

BusyBox 使用 #

BusyBox 是一个多调用的二进制文件。多调用二进制文件是一个可执行程序,但功能上与多个可执行程序相抵。这意味着只有一个 BusyBox 二进制文件,但这个单一的二进制文件就像大量的实用程序一样工作。因为所有内置的实用程序(我们称它们为小程序)可以共享许多常用操作的代码,所以 BusyBox 可以很小。

你也可以通过在命令行 cli 上带一个命令作为参数来调用 BusyBox。例如,输入

sh/bin/busybox ls

也会使 BusyBox 表现为 ls。

当然,在每个命令中加入 /bin/busybox 会很痛苦。所以大多数人都会使用 BusyBox 二进制的链接来调用 BusyBox。

例如,输入

shln -s /bin/busybox ls ./ls

BusyBox 的行为将会像 ls 一样(如果 ls 命令已经被编译到 BusyBox 中)。一般来说,你不需要自己做所有这些链接,因为 BusyBox 的构建系统会在你运行 make install 命令时替你做这些步骤。

如果你在调用 BusyBox 时没有任何参数,它将为你提供一个已经编译到 BusyBox 二进制文件的小程序列表。

BusyBox 帮助文档 #BusyBox 官网 #

https://busybox.net/downloads/BusyBox.html

落后很多个版本,不推荐

BusyBox Manual Pages #shman busybox

比较简略,但是提供了所有选项及解释,本文基于此

如果要查看某一内置命令的帮助,可以使用 --help 参数,如

shbusybox ls --help Linux Manual Pages #

推荐在线版 https://man7.org/linux/man-pages/index.html

不推荐中文版,因为本文档的翻译和其他人的名词可能指代不明

BusyBox 版本 #

本文档基于 Alpine Linux 官方提供的 BusyBox v1.35.0

shlocalhost:~$ uname -a Linux localhost 5.15.89-0-lts #1-Alpine SMP Thu, 19 Jan 2023 08:07:26 +0000 x86_64 Linux localhost:~$ busybox BusyBox v1.35.0 (2022-11-19 10:13:10 UTC) multi-call binary. BusyBox is copyrighted by many authors between 1998-2015. Licensed under GPLv2. See source distribution for detailed copyright notices. Usage: busybox [function [arguments]...] or: busybox --list[-full] or: busybox --install [-s] [DIR] or: function [arguments]... BusyBox is a multi-call binary that combines many common Unix utilities into a single executable. Most people will create a link to busybox for each function they wish to use and BusyBox will act like whatever it was invoked as. Currently defined functions: [, [[, acpid, add-shell, addgroup, adduser, adjtimex, arch, arp, arping, ash, awk, base64, basename, bbconfig, bc, beep, blkdiscard, blkid, blockdev, brctl, bunzip2, bzcat, bzip2, cal, cat, chattr, chgrp, chmod, chown, chpasswd, chroot, chvt, cksum, clear, cmp, comm, cp, cpio, crond, crontab, cryptpw, cut, date, dc, dd, deallocvt, delgroup, deluser, depmod, df, diff, dirname, dmesg, dnsdomainname, dos2unix, du, dumpkmap, echo, ed, egrep, eject, env, ether-wake, expand, expr, factor, fallocate, false, fatattr, fbset, fbsplash, fdflush, fdisk, fgrep, find, findfs, flock, fold, free, fsck, fstrim, fsync, fuser, getopt, getty, grep, groups, gunzip, gzip, halt, hd, head, hexdump, hostid, hostname, hwclock, id, ifconfig, ifdown, ifenslave, ifup, init, inotifyd, insmod, install, ionice, iostat, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, ipneigh, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd, last, less, link, linux32, linux64, ln, loadfont, loadkmap, logger, login, logread, losetup, ls, lsattr, lsmod, lsof, lsusb, lzcat, lzma, lzop, lzopcat, makemime, md5sum, mdev, mesg, microcom, mkdir, mkdosfs, mkfifo, mkfs.vfat, mknod, mkpasswd, mkswap, mktemp, modinfo, modprobe, more, mount, mountpoint, mpstat, mv, nameif, nanddump, nandwrite, nbd-client, nc, netstat, nice, nl, nmeter, nohup, nologin, nproc, nsenter, nslookup, ntpd, od, openvt, partprobe, passwd, paste, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, pmap, poweroff, printenv, printf, ps, pscan, pstree, pwd, pwdx, raidautorun, rdate, rdev, readahead, readlink, realpath, reboot, reformime, remove-shell, renice, reset, resize, rev, rfkill, rm, rmdir, rmmod, route, run-parts, sed, sendmail, seq, setconsole, setfont, setkeycodes, setlogcons, setpriv, setserial, setsid, sh, sha1sum, sha256sum, sha3sum, sha512sum, showkey, shred, shuf, slattach, sleep, sort, split, stat, strings, stty, su, sum, swapoff, swapon, switch_root, sync, sysctl, syslogd, tac, tail, tar, tee, test, time, timeout, top, touch, tr, traceroute, traceroute6, true, truncate, tty, ttysize, tunctl, udhcpc, udhcpc6, umount, uname, unexpand, uniq, unix2dos, unlink, unlzma, unlzop, unshare, unxz, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock, volname, watch, watchdog, wc, wget, which, who, whoami, whois, xargs, xxd, xzcat, yes, zcat


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3